import { HttpUrlVariable } from '@/constants'
import type { SendCodeParams } from '@/types/enum'
import type {
  CodeResult,
  EmptyObject,
  LoginMobileParams,
  LoginParams,
  LoginResult,
  PatientItem,
  UploadResult,
  UserData,
} from '@/types/user'
import RequestHttp from '@/utils/request'

export const loginAPI = (data: LoginParams) =>
  RequestHttp.post<LoginResult, LoginParams>(HttpUrlVariable.LOGIN_URL, data)
/***
 * 验证码接口
 *
 */
export const sendCodeAPI = (params: SendCodeParams) =>
  RequestHttp.get<CodeResult, SendCodeParams>(HttpUrlVariable.SEND_CODE_URL, params)

/**
 * 验证码登录
 *
 */
export const loginByCodeAPI = (data: LoginMobileParams) =>
  RequestHttp.post<LoginResult, LoginMobileParams>(HttpUrlVariable.LOGIN_CODE_URL, data)

/**
 * 获取个人信息
 * **/
export const getUserInfoAPI = () => RequestHttp.get<UserData>(HttpUrlVariable.MY_USER_URL)

//问诊-查询患者列表信息
export const getpatientAPI = () => RequestHttp.get<PatientItem[]>(HttpUrlVariable.MYLIST_URL)

//问诊-添加患者信息
export const addpatientAPI = (data: EmptyObject) =>
  RequestHttp.post<EmptyObject>(HttpUrlVariable.ADD_PATIENT_URL, data)

//问诊-删除患者信息
export const delArchiveAPI = (id: string) =>
  RequestHttp.delete<null>(`${HttpUrlVariable.ARCHIVE_DEL_URL}${id}`)





export const uploadAPI = (filePath: string) =>
  RequestHttp.upload<UploadResult>(HttpUrlVariable.UPLOAD_URL, filePath)


